//
//  SearchInstallerCell.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/3/7.
//
import UIKit

class SearchInstallerCell: UITableViewCell {
    
    var nameLabel: BaseLabel!
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setUpviews()
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if selected {
            self.contentView.backgroundColor = UIColor(hexStr: "#E7F9F2")
        }else {
            self.contentView.backgroundColor = UIColor.white
        }
    }
    private func setUpviews(){
        self.selectionStyle = .none
        //model
        nameLabel = ContentLabel(R.font.interMedium(size: 15))
        nameLabel.numberOfLines = 2
        self.contentView.addSubview(nameLabel)
        nameLabel.snp.makeConstraints { make in
            make.top.equalTo(12)
            make.left.equalTo(16)
            make.height.width.greaterThanOrEqualTo(0)
            make.bottom.equalTo(-12)
        }
    }
    func setData(_ model: MyInformationModel){
        self.nameLabel.text = model.name
    }
}
